﻿using ExchangeClient.ESB.Model;
using ExchangeClient.SAP.Model;
using Newtonsoft.Json;
using System.Text.Json.Nodes;

namespace SyncService.Model
{
    public class ReceiveModel
    {
        /// <summary>
        /// 对应 JSON 中的 baseInfo 部分
        /// </summary>
        [JsonProperty("baseInfo")] // 如果用 System.Text.Json 则用 [JsonPropertyName("baseInfo")]
        public BaseInfo BaseInfo { get; set; } = new BaseInfo();

        /// <summary>
        /// 对应 JSON 中的 result 数组
        /// </summary>
        [JsonProperty("result")] // 同上，根据序列化库选特性
        public List<ResultItem> Result { get; set; } = new List<ResultItem>();
    }
    public class DataProcessing
    {
        public string? SerialNo { get; set; }
        public JsonArray? Data { get; set; }
    }

    public class BaseInfo
    {
        [JsonProperty("interID")]
        public dynamic InterID { get; set; }

        [JsonProperty("msgID")]
        public dynamic MsgID { get; set; }

        [JsonProperty("transID")]
        public dynamic TransID { get; set; }

        /// <summary>
        /// 发送方
        /// </summary>
        [JsonProperty("Sender")]
        public dynamic Sender { get; set; }

        /// <summary>
        /// 接收方
        /// </summary>
        [JsonProperty("Receiver")]

        public dynamic Receiver { get; set; }
        [JsonProperty("SendTime")]

        public dynamic SendTime { get; set; }

    }


    public class ResultItem
    {
        /// <summary>
        /// 单据编号
        /// </summary>
        [JsonProperty("zdjbh")]
        public dynamic zdjbh { get; set; }

        /// <summary>
        /// 行项目
        /// </summary>
        [JsonProperty("zdjbh_it")]
        public dynamic zdjbh_it { get; set; }

        /// <summary>
        /// 公司代码
        /// </summary>
        [JsonProperty("bukrs_x")]
        public dynamic? bukrs_x { get; set; }

        /// <summary>
        /// 财务资产编码
        /// </summary>
        [JsonProperty("anln1_x")]
        public dynamic anln1_x { get; set; } = string.Empty;

        /// <summary>
        /// 资产编码
        /// </summary>
        [JsonProperty("barCode")]
        public dynamic barCode { get; set; }

        /// <summary>
        /// 成功或失败状态
        /// </summary>
        [JsonProperty("type")]
        public dynamic type { get; set; }
        /// <summary>
        /// 返回消息内容
        /// </summary>
        [JsonProperty("message")]
        public dynamic message { get; set; }
    }

}
